package datetime

import (
	"fmt"
	"time"
)

const (
	timelaty   = "2006-01-02T15:04:05.000Z"
	timeLayout = "2006-01-02 15:04:05"
	timedate   = "2006-01-02"
)

//转时间戳
func DateToint64(str string) int64 {
	fmt.Println(str)
	times, _ := time.Parse(timelaty, str)
	return times.Unix()
}

//获取当前格式化时间
func DateToString() string {
	ti := time.Now()
	return ti.Format(timeLayout)
}
func DateToint642(str string) int64 {
	fmt.Println(str)
	times, _ := time.Parse(timeLayout, str)
	return times.Unix()
}
func GetTime() (t1, t2 int64) {
	ti := time.Now()
	date := ti.Format(timedate)
	t1 = DateToint642(fmt.Sprintf("%v 00:00:00", date))
	t2 = DateToint642(fmt.Sprintf("%v 23:59:59", date))
	return
}
